package br.ufal.questione.domain;

import java.io.Serializable;
import java.util.Set;
import java.util.HashSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;



@Entity
@Table(name = "universidade", schema = "questione")
public class Universidade implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 7545473991992508749L;
	@Id
	@SequenceGenerator(name = "sequence-generator",  sequenceName = "questione.universidade_ID_seq", allocationSize = 1 )
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence-generator")
	@Column(name = "id")
	private Long id;
	
	@Column(name = "nome")
	private String nome;
	
	@OneToMany(mappedBy = "universidade",cascade = CascadeType.ALL)
	private Set<Centro> centros = new HashSet<Centro>();
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	public void setCentros(Set<Centro> centros) {
		this.centros = centros;
	}
	public Set<Centro> getCentros() {
		return centros;
	}
}
